#include <iostream>
using namespace std;
int main()
{
    double a, b, k, r;
    cin >> a >> b;    
    k = int(a / b);    
    r = a - k * b;    
    cout << r;       
    return 0;
}